/* ----------------------------------------------------------------------------
* File: api_command_dispatcher_impl.h
*
* Desc: Dispatcher for command messages implementation
*
* Created: 06/09/2011, by Alexey Korshunov
* ---------------------------------------------------------------------------- */
#ifndef _API_COMMAND_DISPATCHER_IMPL_H_
#define _API_COMMAND_DISPATCHER_IMPL_H_

#include "api_command_dispatcher.h"
#include "api_proxy.h"

namespace SkypeProtection
{
	namespace
	{
		class CommandEventSink;
	}
	
	class APICommandDispatcherImpl
		: public APICommandDispatcher
		, public APIProxy
	{
	public:
		explicit APICommandDispatcherImpl(const APICommandDispatcherParams& params);
		~APICommandDispatcherImpl();

		// APIProxy implementation
		virtual Common::Error RunLogic(SKYPE4COMLib::ISkype* skype);

	private:
		Common::Error StartProxyProcess(SKYPE4COMLib::ISkype* skype, CommandEventSink* sink);
		Common::Error StopProxyProcess(SKYPE4COMLib::ISkype* skype, CommandEventSink* sink);

		std::auto_ptr<APIAttachEventHandler> m_AttachHandler;
		std::auto_ptr<APICommandHandler> m_CommandHandler;
	};
}

#endif // _API_COMMAND_DISPATCHER_IMPL_H_